$(function () {
    //抽取js变量
    var chart_datagrid = $("#chart_datagrid");

    chart_datagrid.datagrid({
        url: "/chart/compensationQuery.do",
        fitColumns: true, // 自适 应列
        fit: true,
        striped: true,  // 斑马线
        pagination: true,
        rownumbers: true,
        pageSize: 10,
        pageNumber: 1,
        singleSelect: true, // 单选
        toolbar: "#chart_toolbar",
        columns: [
            [
                {field: 'groupType', title: '分组类型', width: 80},
                {field: 'totalAmount', title: '总金额', width: 80}
            ]
        ]
    });

});

function query() {
    //获取输入框的值
    var organizationId = $("#organizationId").datebox('getValue');

    //获取最小时间的值
    var minDateTime = $("#beginDate").datebox('getValue');

    //获取最大时间的值
    var maxDateTime = $("#endDate").datebox('getValue');

    //获取分组的值
    var groupType = $("#groupType").datebox('getValue');

    $("#chart_datagrid").datagrid('load', {
        organizationId: organizationId,
        beginDate: minDateTime,
        endDate: maxDateTime,
        groupType: groupType
    })
}